from peak.events import trellis
from wxpita import *
import wxpita.databind

class Person(trellis.Component):
    name = trellis.value('')
    role = trellis.value('')

    @trellis.action
    def show(self):
        print '%s; %s' % (self.name, self.role)

person = Person(name='Lyra Belacqua', role='Main Character')

f = SizedFrame(sizerType='form') [
    StaticText(label='Name'),
    TextCtrl(name='name'),
    StaticText(label='Role'),
    TextCtrl(name='role'),
]

@f.Init
def _():
    wxpita.databind.DataBind(person, f, 'name, role')

f.Show('Data Binding Example')
